package cn.edu.scau.cmi.wujiaxian.exercise9;

import java.text.DecimalFormat;

public class Example9_18 {
	
	public static void main(String[] args) {
		double number = 98765.123456;
		System.out.println(number);
		DecimalFormat df = new DecimalFormat("000000.000");
		String result = df.format(number);
		System.out.println(result);
		number = 12345678.987654;
		System.out.println(number);
		df.applyPattern("#,##,#00.0000$");
		result = df.format(number);
		System.out.println(result);
		number = 0.986796;
		System.out.println(number);
		df.applyPattern("0.0000%");
		result = df.format(number);
		System.out.println(result);
		df.applyPattern("0.0000\u2030");
		result = df.format(number);
		System.out.println(result);
		String money = "9,576,769.345￥";
		System.out.println(money);
		df.applyPattern("#,##,##0.000");
		try {
			Number num = df.parse(money);
			System.out.println(num.doubleValue());
		} catch (Exception e) {
		}
	}
	
}
